home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / include / math.h < prev    next >
C/C++ Source or Header  |  1996-01-30  |  6KB  |  234 lines

  1. /* This is file math.h */
  2. /* This file may have been modified by DJ Delorie (Jan 1991).  If so,
  3. ** these modifications are Coyright (C) 1991 DJ Delorie, 24 Kirsten Ave,
  4. ** Rochester NH, 03867-2954, USA.
  5. */
  6.  
  7. /* This may look like C code, but it is really -*- C++ -*- */
  8. /* 
  9. Copyright (C) 1988 Free Software Foundation
  10.     written by Doug Lea (dl@rocky.oswego.edu)
  11.  
  12. This file is part of GNU CC.
  13.  
  14. GNU CC is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY.  No author or distributor
  16. accepts responsibility to anyone for the consequences of using it
  17. or for whether it serves any particular purpose or works at all,
  18. unless he says so in writing.  Refer to the GNU CC General Public
  19. License for full details.
  20.  
  21. Everyone is granted permission to copy, modify and redistribute
  22. GNU CC, but only under the conditions described in the
  23. GNU CC General Public License.   A copy of this license is
  24. supposed to have been given to you along with GNU CC so you
  25. can know your rights and responsibilities.  It should be in a
  26. file named COPYING.  Among other things, the copyright notice
  27. and this notice must be preserved on all copies.  
  28. */
  29.  
  30.  
  31. #ifndef _math_h
  32. #define _math_h 1
  33.  
  34. #if defined(hp300) && defined(__HAVE_FPU__)
  35. #define __HAVE_68881__ 1
  36. #endif
  37.  
  38.  
  39. #ifdef __HAVE_68881__           /* MC68881/2 Floating-Point Coprocessor */
  40. #include <math-68881.h>
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {                    /* fill in what we've left out */
  44. #endif
  45.  
  46. double  acosh(double);
  47. double  asinh(double);
  48. double  cbrt(double);
  49. double  copysign(double,double);
  50. double  erf(double);
  51. double  erfc(double);
  52. double  finite(double);
  53. double  gamma(double);
  54. double  hypot(double,double);
  55. double  infnan(int);
  56. int     isinf(double);
  57. int     isnan(double);
  58. double  j0(double);
  59. double  j1(double);
  60. double  jn(int, double);
  61. double  lgamma(double);
  62. double  y0(double);
  63. double  y1(double);
  64. double  yn(int, double);
  65.  
  66. double aint(double);
  67. double anint(double);
  68. int irint(double);
  69. int nint(double);
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. /* Please add inline asm code for other machines here! */
  74. #else
  75. #ifdef __cplusplus
  76. extern "C" {
  77. #endif
  78.  
  79. double  acos(double);
  80. double  acosh(double);
  81. double  asin(double);
  82. double  asinh(double);
  83. double  atan(double);
  84. double  atan2(double, double);
  85. double  atanh(double);
  86. double  cbrt(double);
  87. double  ceil(double);
  88. double  copysign(double,double);
  89. double  cos(double);
  90. double  cosh(double);
  91. double  drem(double,double);
  92. double  erf(double);
  93. double  erfc(double);
  94. double  exp(double);
  95. double  expm1(double);
  96. double  fabs(double);
  97. double  finite(double);
  98. double  floor(double);
  99. double  fmod(double,double);
  100. double  frexp(double, int*);
  101. double  gamma(double);
  102. double  hypot(double,double);
  103. double  infnan(int);
  104. #if !defined(sequent) && !defined(DGUX) /* see below */
  105. int     isinf(double);
  106. int     isnan(double);
  107. #endif
  108. double  j0(double);
  109. double  j1(double);
  110. double  jn(int, double);
  111. double  ldexp(double, int);
  112. double  lgamma(double);
  113. double  log(double);
  114. double  log10(double);
  115. double  log1p(double);
  116. double  logb(double);
  117. double  log2(double);
  118. double  modf(double, double*);
  119. long double modfl(long double, long double *);
  120. double  pow(double, double);
  121. double  pow2(double);
  122. double  pow10(double);
  123. double  rint(double);
  124. double  scalb(double, int);
  125. double  sin(double);
  126. double  sinh(double);
  127. double  sqrt(double);
  128. double  tan(double);
  129. double  tanh(double);
  130. double  y0(double);
  131. double  y1(double);
  132. double  yn(int, double);
  133.  
  134. double aint(double);
  135. double anint(double);
  136. int irint(double);
  137. int nint(double);
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141.  
  142. #endif
  143.  
  144. /* libg++ doesn't use this since it is not available on some systems */
  145.  
  146. /* the following ifdef is just for compiling OOPS */
  147.  
  148. #ifndef DONT_DECLARE_EXCEPTION
  149. struct libm_exception
  150. {
  151.   int type;
  152.   char* name;
  153.   double arg1, arg2, retval;
  154. };
  155.  
  156. #define DOMAIN      1
  157. #define SING        2
  158. #define OVERFLOW    3
  159. #define UNDERFLOW   4
  160. #define TLOSS       5
  161. #define PLOSS       6
  162.  
  163. #ifdef __cplusplus
  164. extern "C" int matherr(libm_exception*);
  165. #endif
  166.  
  167. #endif
  168.  
  169. #include <values.h>
  170.  
  171. /* On some systems, HUGE ought to be MAXFLOAT or IEEE infinity */
  172.  
  173. #ifndef HUGE
  174. #define HUGE    MAXDOUBLE
  175. #endif
  176.  
  177. /* sequents don't supply these. The following should suffice */
  178. #if defined(sequent) || defined(DGUX)
  179. static inline int isnan(double x) { return x != x; }
  180. static inline int isinf(double x) { return x > MAXDOUBLE || x < -MAXDOUBLE; }
  181. #endif
  182.  
  183.  
  184. /* These seem to be sun & sysV names of these constants */
  185.  
  186. #ifndef M_E
  187. #define M_E         2.7182818284590452354
  188. #endif
  189. #ifndef M_LOG2E
  190. #define M_LOG2E     1.4426950408889634074
  191. #endif
  192. #ifndef M_LOG10E
  193. #define M_LOG10E    0.43429448190325182765
  194. #endif
  195. #ifndef M_LN2
  196. #define M_LN2       0.69314718055994530942
  197. #endif
  198. #ifndef M_LN10
  199. #define M_LN10      2.30258509299404568402
  200. #endif
  201. #ifndef M_PI
  202. #define M_PI        3.14159265358979323846
  203. #endif
  204. #ifndef M_PI_2
  205. #define M_PI_2      1.57079632679489661923
  206. #endif
  207. #ifndef M_1_PI
  208. #define M_1_PI      0.31830988618379067154
  209. #endif
  210. #ifndef M_PI_4
  211. #define M_PI_4      0.78539816339744830962
  212. #endif
  213. #ifndef M_2_PI
  214. #define M_2_PI      0.63661977236758134308
  215. #endif
  216. #ifndef M_2_SQRTPI
  217. #define M_2_SQRTPI  1.12837916709551257390
  218. #endif
  219. #ifndef M_SQRT2
  220. #define M_SQRT2     1.41421356237309504880
  221. #endif
  222. #ifndef M_SQRT1_2
  223. #define M_SQRT1_2   0.70710678118654752440
  224. #endif
  225.  
  226. #ifndef PI                      /* as in stroustrup */
  227. #define PI  M_PI
  228. #endif
  229. #ifndef PI2
  230. #define PI2  M_PI_2
  231. #endif
  232.  
  233. #endif
  234.